// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import VueLazyLoad from 'vue-lazyload'
import infiniteScroll from 'vue-infinite-scroll'
import {currency} from './util/currency'
import Vuex from 'vuex'

Vue.use(VueLazyLoad, {
	loading: '/static/loading-svg/loading-bars.svg'
});

Vue.use(Vuex);

Vue.use(infiniteScroll);

Vue.config.productionTip = false

Vue.filter("currency", currency);

const store = new Vuex.Store({
	state: {
		nickName: '',
		cartCount: 0
	},
	mutations: {
		updateUserInfo(state, nickName) {
			state.nickName = nickName;
		},
		updateCartCount(state, cartCount) {
			state.cartCount += cartCount;
		},
		initCartCount(state, cartCount) {
			state.cartCount = cartCount;
		}
	}
});

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  template: '<App/>',
  components: { App }
})
// new Vue({
// 	router,
// 	render: h => h(App)
// }).$mount("#app")